package xuhaijia.lanou3g.autohome.forum.forumreusing;
//                .-~~~~~~~~~-._       _.-~~~~~~~~~-.
//            __.'              ~.   .~              `.__
//          .'//                  \./                   \\`.
//        .'//            为什么坚持  想一想当初             \\`.
//      .'// .-~"""""""~~~~-._     |     _,-~~~~"""""""~-.  \\`.
//    .'//.-"                 `-.  |  .-'                 "-. \\`.
//  .'//______.============-..   \ | /   ..-============._______\\`.
//.'//____________________________\|/_____________________________\\`.
// 
//                             

import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ListView;
import android.widget.Toast;

import xuhaijia.lanou3g.autohome.R;
import xuhaijia.lanou3g.autohome.base.BaseFragment;
import xuhaijia.lanou3g.autohome.base.NetTool;

/**
 * Created by 7 on 16/8/17.
 */
public class ListViewFragment extends BaseFragment{

    private ListView listView;
    private JxRecAdapter adapter;

    @Override
    protected int setLayout() {
        return R.layout.fragment_forumreusing;
    }

    @Override
    protected void initView() {
        listView = bindView(R.id.fragment_forumreusing_lv);
    }

    @Override
    protected void initData() {
        Bundle b = getArguments();
        String url = b.getString("url");
        adapter = new JxRecAdapter(mContext);
        View empty = LayoutInflater.from(mContext).inflate(R.layout.empty,null);
        listView.setAdapter(adapter);
        listView.setEmptyView(empty);
        mNetTool.getNetData(url, ListViewBean.class, new NetTool.NetListener<ListViewBean>() {
            @Override
            public void onSuccess(ListViewBean listViewBean) {
                adapter.setListViewBean(listViewBean);

            }
            @Override
            public void onError(String errorMsg) {
                Toast.makeText(mContext, "网络请求失败", Toast.LENGTH_SHORT).show();
            }
        });

    }

    @Override
    public void load() {

    }

    @Override
    public void refresh() {

    }
}
